function ajaxPost(url, params, callback) {
    var name = 'csrf_token';

    params.csrf_token = jQuery('head meta[name="' + name + '"]').attr('content');

    jQuery.ajax({
        type: 'POST',
        url: url,
        data: params,
        dataType: 'JSON',
        success: function (res) {
            jQuery('head meta[name="' + name + '"]').attr('content', res[name]);
            delete res[name];
            if (callback !== undefined) {
                callback(res);
            }
        }
    });
}
